<?php
	/**
	 * Default file resource.
	 * @author IMP
	 */
	
	class DefaultFileResource implements PublicResource {
		private $content, $type;
		
		public function __construct(File $f){
			$this->content = $f->read();
			$this->type = $f->getMIMEType();
		}
		
		public function getContentType(){
			return $this->type;
		}
		
		public function emit(){
			echo $this->content;
		}
		
		public function save(File $f){
			$f->write($this->content);
		}
		
		public static function formFilename($name){
			return $name;
		}
		
		public static function open(File $f){
			return new self($f);
		}
	}
?>